package edu.suda.xsap.controller;

import edu.suda.xsap.dto.MemberDto;
import edu.suda.xsap.service.MemberService;
import edu.suda.xsapadminutils.common.Result;
import edu.suda.xsapadminvo.MemberVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/member")
public class MemberController {
    @Autowired
    private MemberService memberService;

    @PostMapping("/save")
    public Result save(@RequestBody MemberVO memberVO) {
        return memberService.save(memberVO);
    }

    @GetMapping("/list")
    public List<MemberDto> findAll() {
        return memberService.findAll();
    }

    @PostMapping("/update")
    public Result update(@RequestBody MemberVO memberVO) {
        return memberService.update(memberVO);
    }

    @PostMapping("/delete")
    public Result delete(@RequestBody MemberVO memberVO) {
        return memberService.delete(memberVO);
    }


}
